<template>
    <z-paging
        :paging-style="{ background: '#f6f6f6' }"
        ref="paging"
        :refresher-out-rate="0.8"
        :show-empty-view-reload-when-error="false"
        :empty-view-img-style="{ width: '308rpx', height: '308rpx' }"
        empty-view-error-img="https://oneredhealth.oss-cn-hangzhou.aliyuncs.com/2023/10/12/1c53b8aed0c74201bb092265803a1d48.png"
        empty-view-img="https://oneredhealth.oss-cn-hangzhou.aliyuncs.com/2023/10/12/987eadb1d50949a0a7e25dbbd99abe30.png"
        empty-view-error-text="暂无商品"
        bg-color="#FFF"
        safe-area-inset-bottom
    >
		<!-- 商品列表 -->
		<view class="content">
			<!-- 一家店 -->
			<view class="carbox" v-for="(item,index) in cartList" :key="index">
				<view class="flex_wrap row_middle row_between">
					<view class="flex_wrap row_middle">
						<view v-if="!item.selected" @click="chooseShopSelect(index)" class="chooseAll"></view>
						<view v-else @click="chooseShopSelect(index)" class="alltrue"></view>
						
						<view style="margin-left: 20rpx;">
							<u-icon name="https://oneredhealth.oss-cn-hangzhou.aliyuncs.com/2024/07/24/53c9c50685934175911277bbe3d5ad14.png" labelSize="28rpx" labelColor="#3D3D3D" size="32rpx" :label="item.tenantName" />
						</view>
					</view>
					<u-icon name="arrow-right" color="#adadad" size="36rpx" />
				</view>
				<!-- 一个产品 -->
				<view style="padding-top: 40rpx;" v-for="(items,indexs) in item.shoppingCartVOList" :key="indexs">
					
					<u-swipe-action>
						<u-swipe-action-item
						  :options="options1"
						  @click="delGoods(items)"
						>
						  <view class="carbox_son ">
							  <view v-if="!items.selected" @click="items.goodsStatus == 1 ? chooseGoodsSelect(index, indexs) : ''"
							  	class="chooseAll"></view>
							  <view v-else @click="chooseGoodsSelect(index, indexs)" class="alltrue"></view>
							  <view class="goodImg">
							  	<u-image :src="items.thumbnail" width="156rpx" height="156rpx" radius="16rpx" />
							  	<view class="noBuyImg" v-if="items.goodsStatus !== 1">不可购买</view>
							  </view>
							  <view class="goodsDetail">
							  	<view class="goodName">
							  		<u-text :color="items.goodsStatus == 1 ? '#333333' : '#AAAAAA'" size="28rpx" :text="items.goodsName" :lines="2" lineHeight="44rpx" />
							  	</view>
							  	<view class="flex_wrap row_middle row_between">
							  		<!-- 价格 -->
							  		<view class="price" v-if="items.goodsStatus == 1">￥{{goodsSkuListPrice(items)}}</view>
							  		<u-text v-if="items.goodsStatus !== 1" color="#777" size="28rpx" text="商品已下架" />
							  		<!-- 加减按钮 -->
							  		<view class="flex_wrap" v-if="items.goodsStatus == 1">
							  			<view
							  				@click="chooseMinus(items,index, indexs)"
							  				slot="minus"
							  				class="minus"
							  			>
							  				<u-icon name="minus" size="12"></u-icon>
							  			</view>
							  			<text slot="input" class="input">{{items.additionalPurchaseQuantity}}</text>
							  			<view
							  				@click="chooseAddNum(items,index, indexs)"
							  				slot="plus"
							  				class="plus"
							  			>
							  				<u-icon name="plus" color="#FFFFFF" size="12"></u-icon>
							  			</view>
							  		</view>
							  	</view>
							  </view>
						  </view>
						</u-swipe-action-item>
					</u-swipe-action>
				</view>
			</view>
		</view>
        <view
            slot="bottom"
        >
			<view class="bottomfixed flex_wrap row_between row_middle">
				<u-checkbox-group>
				    <u-checkbox
				        :checked="isCheckAll"
				        label="全选"
				        size="40rpx"
				        label-size="32rpx"
				        label-color="#666666"
				        @change="chooseCheckAll"
				        shape="circle"
				    ></u-checkbox
				></u-checkbox-group>
				
				<view class="flex_wrap row_middle">
				    <view style="margin-right: 20rpx">
				        <u-text
				            size="28rpx"
				            color="#3D3D3D"
				            :text="'合计：￥'+total"
				        />
				    </view>
				    <u-button
						:text="'结算('+sum+')'"
				        :customStyle="{ ...buttonCustomStyle }"
				        color="#1682FF"
				        shape="circle"
				        :plain="true"
				        @click="sum !== 0 ?openBuy() : ''"
				    />
				</view>
			</view>
           
			
			<u-popup :round="20" :show="show" @close="close" @open="open">
			    <view
			        class="specifications safeAreaBottom"
			        @touchmove.stop.prevent="
			            () => {
			                return;
			            }
			        "
			    >
			        <view class="price_total">
			            <view>
			                <text class="price_t">￥</text>
			                <text>{{total}}</text>
			            </view>
			        </view>
			        <view class="flex_wrap">
			            <text class="total">配送方式</text>
			            <view class="flex_wrap">
			                <view
			                    :class="[
			                        listIndex == i
			                            ? 'typeBox active'
			                            : 'typeBox',
			                    ]"
			                    v-for="(item, i) in list"
			                    :key="i"
			                    @click="listIndex = i"
			                    ><u-icon
			                        :name="
			                            listIndex === i ? item.icon1 : item.icon
			                        "
			                    ></u-icon>
			                    <text>{{ item.title }}</text></view
			                >
			            </view>
			        </view>
			        <u-gap
			            marginTop="20rpx"
			            marginBottom="24rpx"
			            height="2rpx;"
			            bgColor="#F3F3F3"
			        ></u-gap>
			        <!-- 地址 -->
			        <chooseAddress
			            v-show="!listIndex"
			            ref="childRef"
			            @changeAddress="changeAddress"
			        ></chooseAddress>
			        <view class="itemBox" v-show="listIndex">
			            <u-form ref="uForm" :model="loginForm">
			                <u-form-item
			                    labelWidth="60"
			                    label="姓名"
			                    prop="receiveName"
			                >
			                    <view class="formInput">
			                        <u-input
			                            placeholder="请输入名字"
			                            v-model="loginForm.receiveName"
			                            clearable
			                            border="none"
			                            fontSize="26rpx"
			                            color="#333"
			                            customStyle="background:#F3F3F3;border-radius: 6px"
			                        ></u-input>
			                    </view>
			                </u-form-item>
			
			                <u-form-item
			                    label="手机号"
			                    labelWidth="60"
			                    prop="receivePhone"
			                >
			                    <view class="formInput">
			                        <u-input
			                            placeholder="请输入手机号"
			                            border="none"
			                            fontSize="26rpx"
			                            color="#333"
			                            v-model="loginForm.receivePhone"
			                            clearable
			                        />
			                    </view>
			                </u-form-item>
			            </u-form>
			        </view>
			        <u-gap
			            marginTop="20rpx"
			            marginBottom="24rpx"
			            height="2rpx;"
			            bgColor="#F3F3F3"
			        ></u-gap>
			        <scroll-view
			            scroll-y="true"
			            style="max-height: 600rpx"
			            v-if="currentProduct.simpleSpecs"
			        >
			            <view
			                v-for="(item, index) in currentProduct.simpleSpecs"
			                :key="item.specificationName"
			            >
			                <u-text
			                    :text="item.specificationName"
			                    size="28rpx"
			                    bold
			                ></u-text>
			                <u-gap height="16rpx;"></u-gap>
			                <view class="flex_wrap typeChoose">
			                    <view class="specs">
			                        <view
			                            class="tag-item"
			                            v-for="(
			                                specsItem, specsItemIndex
			                            ) in item.items"
			                            :key="specsItem.value"
			                        >
			                            <u-tag
			                                borderColor="#588BF3"
			                                size="medium"
			                                :text="specsItem.value"
			                                :plain="!specsItem.checked"
			                                :name="specsItemIndex"
			                                @click="radioClick($event, index)"
			                            />
			                        </view>
			                    </view>
			                </view>
			                <u-gap
			                    marginTop="6rpx"
			                    marginBottom="24rpx"
			                    height="2rpx;"
			                    bgColor="#F3F3F3"
			                ></u-gap>
			            </view>
			        </scroll-view>
					<!-- 余额>优选价或者余额大于支付金额 -->
					<view
						v-if="balance > total"
					    class="flex_wrap row_between"
					    style="
					        padding-right: 34rpx;
					        box-sizing: border-box;
					        margin: 32rpx 0;
					    "
					>
					    <view style="width: 200rpx">
					        <u-text text="支付类型" size="28rpx" bold></u-text>
					    </view>
					    <view>
					        <u-radio-group placement="row" v-model="payType">
					            <u-radio
					                activeColor="red"
					                label="微信"
					                :name="0"
					            ></u-radio>
					            <view style="width: 30rpx"></view>
					            <u-radio
					                activeColor="red"
					                label="余额"
					                :name="1"
					            ></u-radio>
					        </u-radio-group>
					    </view>
					</view>
			        <u-button
			            :disabled="productCount === 0 ? true : false"
			            text="立即支付"
			            color="#588BF3"
			            :customStyle="{
			                ...buyButtonCustomStyle,
			                width: '694rpx',
			                marginBottom: '40rpx',
			            }"
			            shape="circle"
			            @click="buy()"
			        />
			    </view>
			</u-popup>
			
			<!-- 余额弹框 -->
			<u-popup
			    :show="balanceShow"
			    mode="bottom"
			    @close="balanceShow = false"
			    @touchmove.stop.prevent="() => {}"
			>
			    <view class="specifications safeAreaBottom">
			       <u-text
			           text="确认付款"
			           size="28rpx"
			           color="#3D3D3D"
			           align="center"
			           margin="20rpx 0 30rpx"
			       />
				   <u-text
				       :text="total"
				       size="60rpx"
				       color="#3D3D3D"
				       align="center"
				       margin="20rpx 0 30rpx"
				   />
				   <view class="flex_wrap row_between">
						<u-text
							text="付款方式"
							size="28rpx"
							color="#666"
						/>
						<u-text
							text="余额"
							size="28rpx"
							color="#666"
							align="right"
						/>
				   </view>
				   <view class="flex_wrap row_between">
						<u-text
							text="余额金额"
							size="28rpx"
							color="#3D3D3D"
							margin="30rpx 0"
						/>
						<u-text
							:text="balance"
							size="28rpx"
							color="#3D3D3D"
							align="right"
							margin="30rpx 0"
						/>
				   </view>
				   <view class="flex_wrap row_between">
						<u-text
							text="数量"
							size="28rpx"
							color="#3D3D3D"
						/>
						<u-text
							:text="'x'+ sum"
							size="28rpx"
							color="#3D3D3D"
							align="right"
						/>
				   </view>
				   <u-button
				       text="确认支付"
				       color="#588BF3"
				       :customStyle="{
				           ...buttonCustomStyle1,
				           width: '694rpx',
				           marginBottom: '20rpx',
				           marginTop: '70rpx',
				       }"
				       shape="circle"
				       @click="balanceBuy()"
				   />
			    </view>
			</u-popup>
        </view>
    </z-paging>
</template>

<script>
import {
	listShoppingCart,
	confirmOrderShoppingCart,
	updateShoppingCart
} from "@/api/shop.js";
import { getRememberHealthManagered} from "@/api/order.js";
import { getCustomerInfoByToken } from "@/api/login.js";
import { baseUrl } from "@/config/tendIdConfig";
import chooseAddress from "../components/changeAddress";
import {
		formatDecimal
	} from "@/utils/index.js"
	import {
		numDiv
	} from "@/js_sdk/nl-precisionNum/precisionNum.js"
export default {
		data() {
			return {
				 options1: [{
					text: '删除',
					style: {
						backgroundColor: '#f56c6c',
					}
				}],
				payIdValue:[],//选中商品得id
				buttonCustomStyle: {
				    width: "158rpx",
				    height: "58rpx",
				    fontSize: "28rpx",
				},
				buyButtonCustomStyle: {
				    width: "574rpx",
				    height: "80rpx",
				    outline: "none",
				    border: "none",
				    // fontSize: '32rpx'
				},
				buttonCustomStyle1: {
				    width: "574rpx",
				    height: "80rpx",
				    outline: "none",
				    border: "none",
				},
				cartList:[],
				goodsLoseEfficacy: [],
				total: '0.00', // 合计金额
				sum: 0, // 下单总数
				isCheckAll: false, // 判断全选
				loginFormRules: {
				    receiveName: [
				        {
				            type: "string",
				            required: true,
				            message: "请填写姓名",
				            trigger: ["blur", "change"],
				        },
				    ],
				    receivePhone: [
				        {
				            required: true,
				            message: "请输入手机号",
				            trigger: ["change", "blur"],
				        },
				        {
				            validator: (rule, value, callback) => {
				                return uni.$u.test.mobile(value);
				            },
				            message: "手机号码不正确",
				            trigger: ["change", "blur"],
				        },
				    ],
				},
				loginForm: {
				    receivePhone: "",
				    receiveName: "",
				},
				show:false,
				list: [
				    {
				        title: "快递",
				        icon: "https://test-health-s.oss-cn-hangzhou.aliyuncs.com/report/order/2023/12/06/1e905b8d36d94a9784312859384aec73.png",
				        icon1: " https://test-health-s.oss-cn-hangzhou.aliyuncs.com/report/order/2023/12/06/bcea68b639784347aa84de33b43eb9e8.png",
				    },
				    {
				        title: "自提",
				        icon: "https://test-health-s.oss-cn-hangzhou.aliyuncs.com/report/order/2023/12/06/a38f3fc8053949deb02b86a733c925a4.png",
				        icon1: "https://test-health-s.oss-cn-hangzhou.aliyuncs.com/report/order/2023/12/06/557b096fc54c4db0a0313a03f8bc2d78.png",
				    },
				],
				listIndex: 0,
				payType: 0,
				balance:0,
				numDiv, //除
				balanceShow:false
			}
		},
		created() {
		    this.$store.dispatch("GET_ADDRESS_LIST");
		},
		onLoad() {
			this.queryList()
		},
		onReady() {
		    this.$refs.uForm.setRules(this.loginFormRules);
		},
		components: {
		    chooseAddress,
		},
		computed: {
			goodsSkuListPrice() {
				return (item) => {
					const money = item.price
					return formatDecimal(numDiv(money, 100))
				}
			}
		},
		methods: {
			delGoods(items) {
				let goodsDelId = items.id
				const that = this;
				// console.log("删除");
				uni.showModal({
				    title: "",
				    content: "确定要删除该商品吗",
				    success: function (res) {
				        if (res.confirm) {
				            const token =
				                that.$store.getters?.customer_token ||
				                uni.getStorageSync("customer_token");
				            uni.request({
				                url:
				                    baseUrl +
				                    `/customer/shopping_cart/removeShoppingCart?shoppingCartId=${goodsDelId}`,
				                method: "DELETE",
				                header: {
				                    Authorization: token,
				                },
				                success(res) {
				                    uni.$u.toast("删除成功！");
				                    that.queryList()
									that.isCheckAll = false
									that.total = 0.00
									that.sum = 0
				                },
				            });
				        } else if (res.cancel) {
				        }
				    },
				});
			   
			},
			buy() {
			    this.listIndex &&
			        this.$refs.uForm.validate().then(async () => {
			            await this.toPay();
			        });
			    !this.listIndex && this.toPay();
			},
			async toPay() {
			    const that = this;
			    if (!this.consigneeId && !this.listIndex) {
			        uni.$u.toast("收货地址不可为空！");
			        return;
			    }
				if (this.payType) {
				    console.log("调用余额支付接口",this.payType);
					this.show = false;
					this.balanceShow = true;
				    return;
				}
				
			    let data;
			    // 参数
			    let params = {
			        consigneeId: this.consigneeId, //地址id
			        // orderPaymentType: "1", //支付类型
					orderPaymentType: this.payType ? "4" : "1", //订单支付方式：1微信，2积分，3赠送，4余额
					orderAmount:this.total,//订单金额
					orderReceiveType: this.listIndex === 0 ? 1 : 2, //1邮寄，2自提'
					shoppingCartIdList:this.payIdValue,//购物车ID集合
			    };
			    // 自提
			    this.listIndex && (params = { ...params, ...this.loginForm });
			
			console.log(params,'params>>>')
			    // 下单
			    const result = await confirmOrderShoppingCart(params);
			    data = result.data;
			    console.log(result,data,'掉支付成功');
			
			    // 微信支付
			    uni.requestPayment({
			        provider: "wxpay",
			        timeStamp: data.timeStamp,
			        nonceStr: data.nonceStr,
			        package: data.packageValue,
			        signType: "MD5",
			        paySign: data.paySign,
			        success: function (res) {
			            if (res.errMsg === "requestPayment:ok") {
							that.getIsWeChat()
			            }
			        },
			        fail: function (err) {
			            if (err.errMsg === "requestPayment:fail cancel") {
			                uni.$u.route({
			                    type: "redirectTo",
			                    url: "pages_shop1/order/order_list/index",
			                    params: {
			                        status: "fail",
			                        orderNum: data.outTradeNo,
			                    },
			                });
			            }
			        },
			    });
			},
			async balanceBuy() {
			    const that = this;
			    if (!this.consigneeId && !this.listIndex) {
			        uni.$u.toast("收货地址不可为空！");
			        return;
			    }
			    let data;
			    // 参数
			    let params = {
			        consigneeId: this.consigneeId, //地址id
					orderPaymentType: this.payType ? "4" : "1", //订单支付方式：1微信，2积分，3赠送，4余额
					orderAmount:this.total,//订单金额
					orderReceiveType: this.listIndex === 0 ? 1 : 2, //1邮寄，2自提'
					shoppingCartIdList:this.payIdValue,//购物车ID集合
			    };
			    // 自提
			    this.listIndex && (params = { ...params, ...this.loginForm });
			    // 下单
			    const result = await confirmOrderShoppingCart(params);
			    data = result.data;
			    console.log(result,data,'掉支付成功');
				uni.$u.route({
				    type: "redirectTo",
				    url: "pages_shop1/order/order_list/index",
				});
			},
			getIsWeChat(){
				getRememberHealthManagered().then((res) => {
				    if (res.code === 200 && res.data) {
				        uni.$u.route({
				            type: "redirectTo",
				            url: "pages_shop1/addWeChat/index",
				        	params: {
				        	    wcName: res.data.nickName,
				        		wcImgUrl:res.data.wechatCpQrCode
				        	},
				        });
				    }else{
						uni.$u.route({
						    type: "redirectTo",
						    url: "pages_shop1/order/order_list/index",
						});
					}
				});
			},
			
			
			
			changeAddress(id) {
			    this.consigneeId = id;
			},
			open() {},
			close() { this.show = false; },
			showPaymentTip() {
			uni.showToast({
				title: '支付功能暂未开放',
				icon: 'none',
				duration: 2000
			});
		},
		openBuy(){
				this.show = true;
				this.payType = 0
				getCustomerInfoByToken().then((res) => {
					const balance = res.data.balance;
					this.balance = numDiv(balance.toFixed(2), 100)
					this.loginForm.receiveName = res.data.realName
					this.loginForm.receivePhone = res.data.mobile
					console.log(this.loginForm.receiveName,this.loginForm.receivePhone ,'this.balance>>')
				});
			},
			async queryList() {
				const params = {
					pageNum: 1,
					pageSize: 20,
				};
				let result = await listShoppingCart(params);
				console.log(result.data,'result>>')
				this.cartList = result.data
			},
			
			// 增加数量
			chooseAddNum(items,index, gindex) {
				let cartList = this.cartList; // 购物车商品列表
				let additionalPurchaseQuantity = cartList[index].shoppingCartVOList[gindex].additionalPurchaseQuantity; // 获取当前数量
				additionalPurchaseQuantity = additionalPurchaseQuantity + 1; // 每点击一次加1
				cartList[index].shoppingCartVOList[gindex].additionalPurchaseQuantity = additionalPurchaseQuantity; // 数量
				
				let goodsId = items.id
				let params = {
					id: goodsId,
					additionalPurchaseQuantity: additionalPurchaseQuantity
				};
				const result = updateShoppingCart(params);//修改数量
				this.totalPrice()
			},
			// 减少数量
			chooseMinus(items,index, gindex) {
				console.log(items, index,gindex,'index, gindex')
				let cartList = this.cartList; // 购物车商品列表
				let additionalPurchaseQuantity = cartList[index].shoppingCartVOList[gindex].additionalPurchaseQuantity; // 获取当前数量
				if (additionalPurchaseQuantity <= 1) {
					return
				}
				additionalPurchaseQuantity = additionalPurchaseQuantity - 1; // 每点击一次加1
				cartList[index].shoppingCartVOList[gindex].additionalPurchaseQuantity = additionalPurchaseQuantity;
				let goodsId = items.id
				let params = {
					id: goodsId,
					additionalPurchaseQuantity: additionalPurchaseQuantity
				};
				const result = updateShoppingCart(params);//修改数量
				this.totalPrice()
			},
			// 计算总价
			totalPrice() {
				let cartList = this.cartList;
				let total = 0;
				let additionalPurchaseQuantity = 0;
				for (let i = 0; i < cartList.length; i++) {
					for (let j = 0; j < cartList[i].shoppingCartVOList.length; j++) {
						if (cartList[i].shoppingCartVOList[j].selected) {
							total += cartList[i].shoppingCartVOList[j].price * cartList[i].shoppingCartVOList[j].additionalPurchaseQuantity;
							additionalPurchaseQuantity += cartList[i].shoppingCartVOList[j].additionalPurchaseQuantity;
						}
					}
				}
				this.sum = additionalPurchaseQuantity;
				this.total = this.sum ? formatDecimal(numDiv(parseFloat(total).toFixed(2), 100)) : '0.00'
			},
			// 店铺选中反选
			chooseShopSelect(index) {
				let cartList = this.cartList;
				cartList[index].selected = !cartList[index].selected;
				for (let i = 0; i < cartList[index].shoppingCartVOList.length; i++) {
					if(cartList[index].shoppingCartVOList[i].goodsStatus == 1){
						cartList[index].shoppingCartVOList[i].selected = cartList[index].selected
						
						if(cartList[index].selected){
							if(!this.payIdValue.includes(cartList[index].shoppingCartVOList[i].id)){
								this.payIdValue.push(cartList[index].shoppingCartVOList[i].id)
							}
						}else{
							this.payIdValue =this.payIdValue.filter(item => (item != cartList[index].shoppingCartVOList[i].id))
							console.log(this.payIdValue,'this.payIdValue>')
						}
						console.log(this.payIdValue,'111')
					}
				}
				this.checkAllCondition()
				this.totalPrice()
			},
			// 商品选中反选
			chooseGoodsSelect(index, gindex) {
				let cartList = this.cartList;
				let count = 0;
				let goodsList = cartList[index].shoppingCartVOList; // 当前店铺下商品列表
				let shoppingCartVOList = goodsList[gindex]; // 当前商品数组

				if (shoppingCartVOList.selected) {
					console.log(shoppingCartVOList.selected,'单选点击')
					cartList[index].shoppingCartVOList[gindex].selected = false; // 改变当前商品状态
					cartList[index].selected = false; // 改变店铺状态
					
					this.payIdValue =this.payIdValue.filter(item => (item != cartList[index].shoppingCartVOList[gindex].id))
					console.log(this.payIdValue,'this.payIdValue>')
				} else {
					console.log('单选点击else')
					cartList[index].shoppingCartVOList[gindex].selected = true;
					
					this.payIdValue.push(cartList[index].shoppingCartVOList[gindex].id)
					console.log(this.payIdValue,'this.payIdValue>')
					
					// 当店铺选中商品数量与店铺总数相等时, 改变店铺状态
					let shopGoodsNum = cartList[index].shoppingCartVOList.length; // 店铺总个数
					let goodsArray = cartList[index].shoppingCartVOList;
					let selectedNum = 0;
					for (var i in goodsArray) {
						if (goodsArray[i].selected) {
							selectedNum++
						}
					}
					if (selectedNum == goodsArray.length) {
						cartList[index].selected = true
					} else {
						cartList[index].selected = false
					}
				}
				this.checkAllCondition()
				this.totalPrice()
			},
			// 全选条件 店铺全选  反之
			checkAllCondition() {
				let isCheckAll = this.isCheckAll;
				let cartList = this.cartList; // 购物车列表数据
				let isCheckAllNum = 0;
				for (let i = 0; i < cartList.length; i++) {
					if (cartList[i].selected == true) {
						isCheckAllNum++
					}
				}
				if (isCheckAllNum == cartList.length) {
					this.isCheckAll = true;
				} else {
					this.isCheckAll = false;
				}
				this.totalPrice()
			},
			// 点击全选
			chooseCheckAll() {
				console.log('全选')
				let cartList = this.cartList;
				let isCheckAll = this.isCheckAll;
				if (isCheckAll) {
					this.isCheckAll = false
				} else {
					this.isCheckAll = true
				}
				for (let i = 0; i < cartList.length; i++) {
					cartList[i].selected = this.isCheckAll;
					for (let j = 0; j < cartList[i].shoppingCartVOList.length; j++) {
						if(cartList[i].shoppingCartVOList[j].goodsStatus == 1){
							cartList[i].shoppingCartVOList[j].selected = this.isCheckAll
							if(this.isCheckAll){
								this.payIdValue.push(cartList[i].shoppingCartVOList[j].id)
							}else{
								this.payIdValue = []
							}
							console.log(this.payIdValue,'111')
						}
					}
					
				}
				this.totalPrice()
			},
		},
	}
</script>

<style>
page {
    background-color: #f6f6f6 !important;
}
</style>

<style scoped lang="scss">
	.minus {
			width: 22px;
			height: 22px;
			border-width: 1px;
			border-color: #E6E6E6;
			border-style: solid;
			border-top-left-radius: 100px;
			border-top-right-radius: 100px;
			border-bottom-left-radius: 100px;
			border-bottom-right-radius: 100px;
			@include flex;
			justify-content: center;
			align-items: center;
		}
	
		.input {
			padding: 0 10px;
		}
	
		.plus {
			width: 22px;
			height: 22px;
			background-color: #588BF3;
			border-radius: 50%;
			/* #ifndef APP-NVUE */
			display: flex;
			/* #endif */
			justify-content: center;
			align-items: center;
		}
		
	.content {
		margin-top: 18rpx;
		display: flex;
		flex-direction: column;
	}
	.carbox {
		width: 100%;
		padding: 36rpx 32rpx 40rpx;
		margin-bottom: 32rpx;
		background-color: #fff;
		border-radius: 16rpx;
	}
	.carbox_son {
		width: 100%;
		// padding-top: 40rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
	}
	
	.chooseAll {
		width: 32rpx;
		height: 32rpx;
		background-color: #fff;
		border-radius: 50%;
		border: 2rpx solid rgba(0, 0, 0, .2);
	}
	.alltrue {
		display: flex;
		width: 32rpx;
		height: 32rpx;
		background-color: #588BF3;
		border-radius: 50%;
		border: 2rpx solid rgba(255, 255, 255, .2);
		position: relative;
	}
	.alltrue::before {
		position: absolute;
		content: '✓';
		color: #fff;
		top: -2rpx;
		right: 6rpx;
		font-size: 26rpx;
	}
	
	.goodsDetail {
		display: flex;
		flex-direction: column;
		flex: 1;
		margin-left: 16rpx;
	}
	.goodImg {
		display: flex;
		margin-left: 20rpx;
		position: relative;
		justify-content: center;
		align-items: center;
		.noBuyImg{
			position: absolute;
			// top: 40%;
			width: 132rpx;
			height: 42rpx;
			background: rgba(0,0,0,0.6);
			border-radius: 302rpx 302rpx 302rpx 302rpx;
			font-size: 24rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 42rpx;
		}
	}
	.goodName{
		height: 88rpx;
		margin-bottom: 16rpx;
	}
	.price {
		font-size: 32rpx;
		color: #FF0000;
	}
	.bottomfixed {
	    width: 100vw;
	    padding: 28rpx 40rpx 50rpx;
	    background-color: #fff;
	}
	
	
	// 地址prope
	.specifications {
		padding: 32rpx;
	     padding-bottom: constant(safe-area-inset-bottom);
	    padding-bottom: env(safe-area-inset-bottom);
	}
	.price_total {
	    display: flex;
	    font-size: 40rpx;
	    font-weight: bold;
	    color: #ff0000;
	    align-items: center;
	    padding-bottom: 24rpx;
	    .price_t {
	        font-size: 24rpx;
	    }
	}
	.total {
	    display: block;
	    width: 448rpx;
	    word-break: break-all;
	    text-overflow: ellipsis;
	    display: -webkit-box;
	    -webkit-box-orient: vertical;
	    -webkit-line-clamp: 2; /* 这里是超出几行省略 */
	    overflow: hidden;
	    font-weight: bold;
	    font-size: 30rpx;
	    color: #333;
	}
	.typeBox {
	    font-size: 28rpx;
	    color: #588bf3;
	    border-radius: 8rpx 8rpx 8rpx 8rpx;
	    border: 2rpx solid #588bf3;
	    width: 140rpx;
	    height: 46rpx;
	    display: flex;
	    align-items: center;
	    justify-content: center;
	    box-sizing: border-box;
	    margin: 0 10rpx;
	}
	.active {
	    background-color: #588bf3;
	    border: 2rpx solid #588bf3;
	    color: #ffffff;
	}
	.formInput,
	.formInput_t {
	    height: 60rpx;
	    background: #f3f3f3;
	    border-radius: 12rpx;
	    display: flex;
	    align-items: center;
	    padding: 0 20rpx;
	}
	
	
	 .u-page {
        padding: 0;
    }

    .u-demo-block__title {
        padding: 10px 0 2px 15px;
    }

    .swipe-action {
        &__content {
             padding: 25rpx 0;
    
            &__text {
                 font-size: 15px;
                 color: $u-main-color;
                 padding-left: 30rpx;
             }
        }
    }
</style>
